﻿using System;
using System.Collections.Generic;

namespace MessagePack.Formatters
{
	// Token: 0x02000013 RID: 19
	public class StackFormatter<T> : CollectionFormatterBase<T, T[], Stack<T>.Enumerator, Stack<T>>
	{
		// Token: 0x0600003D RID: 61 RVA: 0x00002BF6 File Offset: 0x00000FF6
		protected override int? GetCount(Stack<T> sequence)
		{
			return new int?(sequence.Count);
		}

		// Token: 0x0600003E RID: 62 RVA: 0x00002C03 File Offset: 0x00001003
		protected override void Add(T[] collection, int index, T value)
		{
			collection[collection.Length - 1 - index] = value;
		}

		// Token: 0x0600003F RID: 63 RVA: 0x00002C13 File Offset: 0x00001013
		protected override T[] Create(int count)
		{
			return new T[count];
		}

		// Token: 0x06000040 RID: 64 RVA: 0x00002C1B File Offset: 0x0000101B
		protected override Stack<T>.Enumerator GetSourceEnumerator(Stack<T> source)
		{
			return source.GetEnumerator();
		}

		// Token: 0x06000041 RID: 65 RVA: 0x00002C23 File Offset: 0x00001023
		protected override Stack<T> Complete(T[] intermediateCollection)
		{
			return new Stack<T>(intermediateCollection);
		}
	}
}
